import React from 'react'
import { Form, Button, Space } from 'antd'
import { useFormAdd } from './useFormEdit'
import EditForm from '@/components/EditForm'
import PageContainer from '@/components/PageContainer'
import { useNavigate, useSearchParams } from 'react-router-dom'
const Index: React.FC = () => {
  const navigate = useNavigate()
  const [query] = useSearchParams()
  const id = query.get('id')
  const [formEdit] = Form.useForm()
  return (
    <>
      <div className="member_add">
        <PageContainer title={id ? '编辑' : '新建'}>
          <div className="member_add_container" style={{ width: 400 }}>
            <EditForm
              isNotModal={true}
              editConfig={useFormAdd()}
              form={formEdit}
              footer={
                <>
                  <Space>
                    <Button onClick={() => navigate(-1)}>返回</Button>
                    <Button type="primary">提交</Button>
                  </Space>
                </>
              }
            />
          </div>
        </PageContainer>
      </div>
    </>
  )
}

export default Index
